package com.nguc.ngucpractice.dao;

import com.nguc.ngucpractice.common.dao.BaseDao;
import com.nguc.ngucpractice.pojo.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface RoleDao extends BaseDao<Role> {

    @Select("select * from roles where name =#{roleName}")
    @Results(value = {
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "name", property = "roleName"),
            @Result(column = "auth_name", property = "authName"),
            @Result(column = "auth_time", property = "authTime"),
            @Result(column = "create_time", property = "createTime"),
            @Result(column = "menus", property = "menus")
    })
    List<Role> selectByRoleName(String roleName);

    @Select("select count(*) from roles where id = #{id}")
    Integer selCountById(Integer id);

}
